package com.asion.qkan.ui.activity;

import android.annotation.TargetApi;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
import android.widget.Toast;

import com.asion.qkan.R;
import com.facebook.drawee.view.SimpleDraweeView;

public class SheQuActivity extends AppCompatActivity {

    private SimpleDraweeView touxiang;
    private TextView name;
    private TextView text;
    private SimpleDraweeView image;
    private TextView time;
    private TextView comments;
    private TextView like;
    private String aname,atouxiang,atext,aimage,atime,acomments,alike;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_she_qu);
        touxiang = (SimpleDraweeView) findViewById(R.id.sq_touxiang);
        name = (TextView) findViewById(R.id.sq_name);
        text = (TextView) findViewById(R.id.sq_text);
        image = (SimpleDraweeView) findViewById(R.id.sq_image);
        time = (TextView) findViewById(R.id.sq_time);
        comments = (TextView) findViewById(R.id.sq_comments);
        like = (TextView) findViewById(R.id.sq_like);

        Bundle bundle = this.getIntent().getExtras();
        duqu(bundle);
        fuzhi();
        panduan(bundle);
    }

    public void duqu(Bundle bundle){
        aname = bundle.getString("name").toString();
        atouxiang = bundle.getString("touxiang").toString();
        atext = bundle.getString("text").toString();
        atime = bundle.getString("time").toString();
        acomments = bundle.getString("comments").toString();
        alike = bundle.getString("like").toString();
    }
    public void fuzhi(){
        name.setText(aname);
        touxiang.setImageURI(atouxiang);
        text.setText(atext);
        time.setText(atime);
        comments.setText(acomments);
        like.setText(alike);
    }
    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
    public void panduan(Bundle bundle){
        int n = bundle.getInt("n");
        if (n == 1){
            aimage = bundle.getString("image").toString();
            image.setImageURI(aimage);
        }else{
            Toast.makeText(this,"煞笔，这个没图",Toast.LENGTH_SHORT).show();
        }
    }
}
